home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day08 / button.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  970 b   |  28 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Button.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8. TButtonForm *ButtonForm;
  9. //---------------------------------------------------------------------------
  10. __fastcall TButtonForm::TButtonForm(TComponent* Owner)
  11.   : TForm(Owner)
  12. {
  13. }
  14. //---------------------------------------------------------------------------
  15. void __fastcall TButtonForm::EnableAllButtonClick(TObject *Sender)
  16. {
  17.   EnableButtons(this, Sender == EnableAllButton);
  18. }
  19. //---------------------------------------------------------------------
  20. void TButtonForm::EnableButtons(TForm* form, bool enable)
  21. {
  22.   for (int i = 0;i<form->ComponentCount;i++) {
  23.     TButton* button =
  24.       dynamic_cast<TButton*>(form->Components[i]);
  25.     if (button && button->Parent == form) button->Enabled = enable;
  26.   }
  27. }
  28.